using System;
using System.Collections.Generic;
using System.Text;

namespace InfraStructureLayer
{
    public class MD5Crypto
    {
        private static byte[] ToByteArray(object value)
        {
            byte[] result = new byte[] { };
            string val = value as string;
            if (val != null)
                result = new System.Text.UnicodeEncoding().GetBytes(val);
            return result;
        }
        public static string Tomd5(string value)
        {
            byte[] hash = new System.Security.Cryptography.MD5CryptoServiceProvider().ComputeHash(ToByteArray(value));
            string result = System.BitConverter.ToString(hash);
            result = result.Replace("-", "");
            return result;
        }


    }
}
